package com.lfm.generic;

import java.sql.Array;
import java.util.ArrayList;
 @SuppressWarnings({"all"})
public class Generic01 {
    public static void main(String[] args) {
        ArrayList list = new ArrayList();
        list.add(new Dog("Brien", 2));
        list.add(new Dog("Kitty", 5));
        list.add(new Dog("Bruce", 6));

        for (Object o : list) {
            System.out.println(((Dog)o).getName() + "-" + ((Dog)o).getAge());
        }

    }
}

class Dog {
    private String name;
    private int age;


    public Dog(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }



}

class Cat {

    private String name;
    private int age;


    public Cat(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }
}